﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using CoreEx.Common.Extensions;
using CoreEx.Common.Proxy;

namespace CoreEx.Common.Implementation.Proxy
{
    public class PropertyPicker : IPropertyPicker
    {
        public IEnumerable<PropertyInfo> ChooseProxyPropertiesFrom(IEnumerable<Type> types)
        {
            var result = new HashSet<PropertyInfo>();
            foreach (var type in types)
            {
                var properties = type.GetProperties().Except(result);
                properties.ForEach(p => result.Add(p));
            }
            return result;
        }
    }
    
}
